From 14ed2beff5995dba0c810ecb6217319b31c89036 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 7 Nov 2004 04:10:01 +0000 Subject: [PATCH] Jump through a few hoops to make the tooltip on the filter combo box work 2004-11-06 Matthias Clasen * gtk/gtkfilechooserdefault.c (file_pane_create): Jump through a few hoops to make the tooltip on the filter combo box work a bit better. This fixes #157273 and #157074. --- ChangeLog | 4 ++++ ChangeLog.pre-2-10 | 4 ++++ ChangeLog.pre-2-6 | 4 ++++ ChangeLog.pre-2-8 | 4 ++++ gtk/gtkcombobox.c | 1 + gtk/gtkfilechooserdefault.c | 35 ++++++++++++++++++++++++++--------- 6 files changed, 43 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index e26f73c014..d6af84867d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2004-11-06 Matthias Clasen + * gtk/gtkfilechooserdefault.c (file_pane_create): Jump through + a few hoops to make the tooltip on the filter combo box work + a bit better. This fixes #157273 and #157074. + * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_end): Add the ComboCellInfo to the list. (#157528, Carlos Garnacho Parro) diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e26f73c014..d6af84867d 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,9 @@ 2004-11-06 Matthias Clasen + * gtk/gtkfilechooserdefault.c (file_pane_create): Jump through + a few hoops to make the tooltip on the filter combo box work + a bit better. This fixes #157273 and #157074. + * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_end): Add the ComboCellInfo to the list. (#157528, Carlos Garnacho Parro) diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index e26f73c014..d6af84867d 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,5 +1,9 @@ 2004-11-06 Matthias Clasen + * gtk/gtkfilechooserdefault.c (file_pane_create): Jump through + a few hoops to make the tooltip on the filter combo box work + a bit better. This fixes #157273 and #157074. + * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_end): Add the ComboCellInfo to the list. (#157528, Carlos Garnacho Parro) diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index e26f73c014..d6af84867d 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,9 @@ 2004-11-06 Matthias Clasen + * gtk/gtkfilechooserdefault.c (file_pane_create): Jump through + a few hoops to make the tooltip on the filter combo box work + a bit better. This fixes #157273 and #157074. + * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_end): Add the ComboCellInfo to the list. (#157528, Carlos Garnacho Parro) diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index a244204591..9a4976a24a 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -2260,6 +2260,7 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box, if (combo_box->priv->cell_view) { combo_box->priv->button = gtk_toggle_button_new (); + g_signal_connect (combo_box->priv->button, "toggled", G_CALLBACK (gtk_combo_box_button_toggled), combo_box); g_signal_connect_after (combo_box->priv->button, diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index 71bb4909f8..21432a6e4f 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -3135,6 +3135,29 @@ create_path_bar (GtkFileChooserDefault *impl) return path_bar; } +static void +set_filter_tooltip (GtkWidget *widget, + gpointer data) +{ + GtkTooltips *tooltips = (GtkTooltips *)data; + + if (GTK_IS_BUTTON (widget)) + gtk_tooltips_set_tip (tooltips, widget, + _("Select which types of files are shown"), + NULL); +} + +static void +realize_filter_combo (GtkWidget *combo, + gpointer data) +{ + GtkFileChooserDefault *impl = (GtkFileChooserDefault *)data; + + gtk_container_forall (GTK_CONTAINER (combo), + set_filter_tooltip, + impl->tooltips); +} + /* Creates the widgets for the files/folders pane */ static GtkWidget * file_pane_create (GtkFileChooserDefault *impl, @@ -3142,7 +3165,6 @@ file_pane_create (GtkFileChooserDefault *impl, { GtkWidget *vbox; GtkWidget *hbox; - GtkWidget *ebox; GtkWidget *widget; vbox = gtk_vbox_new (FALSE, 6); @@ -3185,17 +3207,12 @@ file_pane_create (GtkFileChooserDefault *impl, impl->filter_combo_hbox = gtk_hbox_new (FALSE, 12); widget = filter_create (impl); - ebox = gtk_event_box_new (); - gtk_container_add (GTK_CONTAINER (ebox), widget); - gtk_widget_show (ebox); - /* We need enter/leave to do tooltips */ - gtk_widget_add_events (ebox, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); - gtk_tooltips_set_tip (impl->tooltips, ebox, - _("Select which types of files are shown"), NULL); + g_signal_connect (widget, "realize", + G_CALLBACK (realize_filter_combo), impl); gtk_widget_show (widget); - gtk_box_pack_end (GTK_BOX (impl->filter_combo_hbox), ebox, FALSE, FALSE, 0); + gtk_box_pack_end (GTK_BOX (impl->filter_combo_hbox), widget, FALSE, FALSE, 0); gtk_size_group_add_widget (size_group, impl->filter_combo_hbox); gtk_box_pack_end (GTK_BOX (vbox), impl->filter_combo_hbox, FALSE, FALSE, 0); -- 2.30.2